home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / bbs / jdrexa10.zip / INST4OF4.DAT / BBS / DOORMENU / PULLDOWN.TXT < prev   
Text File  |  1994-12-21  |  9KB  |  218 lines

  1.  
  2. Implementing user-accessible pull-down menus with Juggernaut.
  3.  
  4. This file will help explain some of the concepts of pull-down menus.  The
  5. sysop's menu system uses these same methods.  This document and the attached
  6. files will be an example, later it can be the basis for your own pull-down
  7. menus.
  8.  
  9.  
  10. OVERVIEW
  11.  
  12. Because these menu's are complex, tricky, and can require lots of ANSI's, it's
  13. best to implement them as a MENU SUB SYSTEM.
  14.  
  15. Which merely uses the "MENU _path" command.
  16.  
  17. We put all our related ANSI's into the directory, then call the menu sub
  18. subsystem.  To exit, we just call our primary menu system.
  19.  
  20. example:  MENU _c:\bbs\doormenu         to call our door-menu sub system
  21.           MENU _c:\bbs                  to return to our primary menu system
  22.  
  23. Thus, two commands:
  24.   GDOR: MENU _c:\bbs\doormenu >d99
  25.   RSYS: MENU _c:\bbs >001
  26.  
  27. On the main menu, we set up an option (such as "Play Door Games") that
  28. executes "GDOR" to go to the DOORMENU menu subsystem.
  29.  
  30. In the menu sub system, we set up options (such as "Quit to Main Menu") that
  31. executes "RSYS" to return back to the main menu (primary menu system).
  32.  
  33. Note that the "MENU" command merely changes menu systems, it's lost without the 
  34. following ">xxx" order which tells it which menu of the new menu system we 
  35. wish to display.
  36.  
  37. Instead of ">xxx" any menu command can be used.  In McEditor the top half is 
  38. menus, and the bottom half is commands.  "MENU" accesses those different 
  39. menus, much like the "L" (load new menu system) command does in McEditor.  The 
  40. actual commands (bottom half of the screen) are common to all menu systems
  41. always.
  42.  
  43. As for getting pull-down menus: that's actually fairly simple.  We do menu 
  44. command defining as normal.  Up/down/left/right arrow keys are just the
  45. hot-keys "^_<>" ([Enter] = "~"). 
  46.  
  47. The last trick is specifying FX.TXT Special FX values that tells the software
  48. "hey this is a pull-down menu".  The left-right movement across the screen is
  49. just different ansi's.
  50.  
  51.  
  52. IMPLEMENATION--MENU LEVEL
  53.  
  54. Included here is the doormenu menu sub system.  It's what I use for my
  55. on-line door games.  It'll give you a good idea of how to implement a
  56. pull-down menu system.  But the commands themselves won't work--since you
  57. didn't define the door commands/etc.
  58.  
  59. As mentioned above, you need to have a GDOR and RSYS command to access this
  60. menu sub system.  I've already pre-created both of these.
  61.  
  62. The first thing that should be remembered is that DOORMENU is not one menu.
  63. It's six pull-down menus put into the same ANSI.  I use left/right arrow
  64. key movement to change between these six menus (as a comparison, the "1ST"
  65. Style only has 5 menus).
  66.  
  67.       -   Domination   Other   Sports   Adventure   Mail
  68.  
  69. Are the basis options.  It starts you out at "Domination".  Hitting left
  70. arrow goes to "-", hitting right arrow goes to "Other".  Each of these is
  71. really just a ">xxx" (goto a menu) commands.
  72.  
  73. To get the pull-down menu effect at this stage, we have to create two ANSIs
  74. for each option: one with the above options and our current one highlighted,
  75. and one with the above options and our current one highlighted and the pull-
  76. down commands available to it.
  77.  
  78. Example: hit [Enter] at "Domination".  We then go to (">xxx") another menu
  79. that actually has (only) the "Domination menu's options" on it.
  80.  
  81.  
  82.       -   Domination   Other   Sports   Adventure   Mail
  83.           ┌─────────────────────┐
  84.           │ Barren Realms Elite │
  85.           │ Food Fight          │
  86.           │ Gang Warfare        │
  87.           │ Gang Warfare Maps   │
  88.           │ Mechwars            │
  89.           └─────────────────────┘
  90.  
  91. To summarize so far:
  92.   From the main menu, we execute "GDOR" which calls up the DOORMENU menu sub
  93.   system and goes to menu d99 (">d99") which displays the ANSI DOORS99.ANS.
  94.   This DOORS99 displays the "command line".
  95.   In the d99 menu, we defined [Enter] to go to menu d20, which displays the
  96.   ANSI DOORS12.ANS.
  97.   This DOORS12 displays the above list of available games.
  98.  
  99. So far, it's nothing really complex, just a lot of trickery with ANSI's and
  100. goto menu commands.  Just TYPE (DOS) all the .ANS's and you'll see the
  101. trickery.  We can do this trickery because the time it takes to redraw one
  102. line of ANSI codes is barely noticable--particularly if it was a line already 
  103. on the screen.
  104.  
  105. Where complexity comes in, however, is with multiple menus and multiple
  106. keystrokes.  For instance, I didn't just define that arrow keys move you
  107. left/right, but also "4" and "6" (keypad).  Further I defined that "D" brings
  108. up the Domination menu, that "Q" or "-" quits, etc.  This is why starting off
  109. with DOORMENU as a basis for another pull-down menu system is so useful, with
  110. all the menu jumping around, one can get lost.
  111.  
  112. Let me re-stress this.  At each menu, I've got a lot of extra commands that
  113. do exactly the same thing.  This is to allow the user maximum flexibility.
  114. They can choose how they want to move about.
  115.  
  116. Go into McEditor and do an "L" then "C:\BBS\DOORMENU" and it'll bring up
  117. this DOORMENU menu sub system.
  118.  
  119. You'll see menu after menu of nothing but ">xxx" orders, with a few RSYS's,
  120. and later on a very few other commands.
  121.  
  122.  
  123. IMPLEMENATION--PULL-DOWN COMMANDS
  124.  
  125. It's these other commands that we now turn to.  They are the pull-down
  126. commands.
  127.  
  128. Remember that we're dealing with six separate menus, and lots of ">xxx"
  129. orders to link them up.  Because we want fancy left-right action, it's 
  130. actually 12 menus but lets not dwell on that.
  131.  
  132. But pull-down menus only concern a single menu, for example Menu d20 which
  133. is our Domination pull-down menu.
  134.  
  135. This menu contains lots of ">xxx" commands and:
  136.    RSYS, DM15, DM06, DM10, DM17, DM08, DM20
  137.  
  138. Only these last commands matter.  They actually do something.
  139.  
  140. RSYS, as mentioned before, merely exit's us back to the main menu.
  141.  
  142. DM15, DM06, DM10, DM17, DM08, DM20 are the door-calling commands.   More
  143. importantly for us, they are each pull-down commands.
  144.  
  145. What does it mean to be a pull-down command?  It means that the user may use
  146. the up/down arrow keys to move up and down the screen to each command.
  147. Un-highlighting the old one, and highlighting the new one.
  148.  
  149. The moving up/down and highlighting is handled by the software.  The Hot-Key
  150. field is not used, however I like to give them values ("ABCDEF...") according
  151. to their top-down position so that the user can just jump to them without
  152. using the arrow keys (or if the first/key letter for each is different, just
  153. use that for the hot-key).  It's just an alternative that makes life easier
  154. for the user.
  155.  
  156. The real secret of pull-downs is the Special FX, Row, Column and Text For FX
  157. fields.
  158.  
  159. Look at the FX.TXT (or FX_TXT.DOC).
  160.  
  161. The "sss" special effect field doesn't allow numbers, because when it does
  162. have numbers, the software uses that to mean "it's to be part of a pull-down
  163. menu".
  164.  
  165. Those numbers are the colors we want to use.  Nothing more.  The coordinates
  166. and the text to use are in the other fields (the same fields we use for
  167. "normal" special effects).
  168.  
  169. The "sss" breaks down as follows:
  170.  
  171.   1st char: 0 or 1  to designate normal colors or bright colors.
  172.   2nd char: 0 to 7  to designate the foreground (text) colors.
  173.   3rd char: 0 to 7  to designate the background colors.
  174.  
  175. These colors are the colors on the menu ANSI.  Their only purpose is to tell
  176. the software what colors to redraw the text string after you move off that
  177. enter to another entry.
  178.  
  179. The colors used by the selection cursor are defined with "_FXBAR=sss" at the
  180. bottom of the FX.TXT file.  Where "sss" corresponds to the same color codes
  181. above.
  182.  
  183. The Row/Column fields tell the software where the effects (in this case
  184. pull-down menu simulation) is to occur for each command.  The software sorts
  185. your commands by Row and will go up/down to the previous/next command 
  186. according to this sorting--you can't have two or more commands with the same
  187. Row.
  188.  
  189. The Text For FX field this contains the text to display.  Both when we
  190. highlight and turn-off.  Ideally it should match what the ANSI displayed.
  191. The software goes through these fields, and uses the longest one to define
  192. how long it's "highlight bar" should be for all the commands.
  193.  
  194. You can mix and match pull-down commands and non-pull-down commands on the
  195. same menu.  Only those commands with SpecialFX > 99 are used for the up/down
  196. positioning and length of hightlight bar calculation.
  197.  
  198. That's it.
  199.  
  200. All the other complexity with this DOORMENU example is to provide the
  201. across-the-top action (left/right arrow key stuff).
  202.  
  203. The +/- keys are automatically drafted as hot-keys to duplicate the up/down 
  204. arrow commands.  For those comm program users without arrow key support.
  205. Of course, you cannot use either the up/down arrows or +/- as menu command
  206. hot-keys on pull-down menus.
  207.  
  208.  
  209.  
  210. NOTES
  211.  
  212. Menu d99 is actually a "first time" menu.  It gives the user instructions, but
  213. is otherwise identical to Menu d02.
  214.  
  215. I use "eans" before most doors.  This display's the ANSI which says "Exiting
  216. to door...".
  217.  
  218.